summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-12-04 03:59:11 +0100
committerGitHub <noreply@github.com>2023-12-04 03:59:11 +0100
commit90e87c40e8628f2ed00a0e0272a9652b7fdb9a96 (patch)
treef88b4827139ff59cd1f5da93f843830d432894aa
parentMerge pull request #12094 from ameerj/gl-buffer-cache-batch-vtx (diff)
parentrenderer_vulkan: adjust window origin and swizzle independently (diff)
downloadyuzu-90e87c40e8628f2ed00a0e0272a9652b7fdb9a96.tar
yuzu-90e87c40e8628f2ed00a0e0272a9652b7fdb9a96.tar.gz
yuzu-90e87c40e8628f2ed00a0e0272a9652b7fdb9a96.tar.bz2
yuzu-90e87c40e8628f2ed00a0e0272a9652b7fdb9a96.tar.lz
yuzu-90e87c40e8628f2ed00a0e0272a9652b7fdb9a96.tar.xz
yuzu-90e87c40e8628f2ed00a0e0272a9652b7fdb9a96.tar.zst
yuzu-90e87c40e8628f2ed00a0e0272a9652b7fdb9a96.zip
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 07222e603..b6f52e017 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -75,14 +75,20 @@ VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t in
const float width = conv(src.scale_x * 2.0f);
float y = conv(src.translate_y - src.scale_y);
float height = conv(src.scale_y * 2.0f);
- bool y_negate = regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft;
- if (!device.IsNvViewportSwizzleSupported()) {
- y_negate = y_negate != (src.swizzle.y == Maxwell::ViewportSwizzle::NegativeY);
+ const bool lower_left = regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft;
+ const bool y_negate = !device.IsNvViewportSwizzleSupported() &&
+ src.swizzle.y == Maxwell::ViewportSwizzle::NegativeY;
+
+ if (lower_left) {
+ // Flip by surface clip height
+ y += conv(static_cast<f32>(regs.surface_clip.height));
+ height = -height;
}
if (y_negate) {
- y += conv(static_cast<f32>(regs.surface_clip.height));
+ // Flip by viewport height
+ y += height;
height = -height;
}